{template 'public/header'}
{template 'public/comhead'}
<link rel="stylesheet" type="text/css" href="../addons/zh_jypx/template/public/ygcsslist.css">
<style type="text/css">
    .yg5_key>div{float: left;line-height: 34px;}
    .store_td1{height: 45px;}
    .store_list_img{width: 60px;height: 60px;}
    .yg5_tabel{border-color: #e5e5e5;outline: 1px solid #e5e5e5;}
    .yg5_tr2>td{padding: 10px 15px;border: 1px solid #e5e5e5;text-align:center;}
    .yg5_tr1>th{
        border: 1px solid #e5e5e5;
        padding-left: 15px;
        background-color: #FAFAFA;
        font-weight: bold;
        text-align: center;
    }
    .yg5_btn{background-color: #EEEEEE;color: #333;border: 1px solid #E4E4E4;border-radius: 6px;width: 100px;height: 34px;}
    /*#frame-2{display: block;visibility: visible;}*/
</style>

<ul class="nav nav-tabs">
  <span class="ygxian"></span>
    <div class="ygdangq">当前位置:</div>    
    <li class="active"><a href="{php echo $this->createWebUrl('task',array('id'=>$_GPC['id']))}">作业列表</a></li>
    <li><a href="{php echo $this->createWebUrl('addtask2',array('id'=>$test['id']))}">添加作业</a></li>
   <!--  <span class="ygxian"></span>
    <div class="ygdangq">作业状态:</div>    -->
 <!--  <li  {if $type=='all'} class="active" {/if}><a href="{php echo $this->createWebUrl('task',array('type'=>all,'id'=>$b['user_id']))}">全部列表</a></li> -->
<!--   <li   {if $type=='tocorrect'} class="active" {/if}><a href="{php echo $this->createWebUrl('task',array('type'=>published,'state'=>1,'id'=>$b['user_id']));}">待批改</a></li>
   <li   {if $type=='becorrect'} class="active" {/if}><a href="{php echo $this->createWebUrl('task',array('type'=>finished,'state'=>2,'id'=>$b['user_id']));}">已批该</a></li> -->
  <!--&lt;!&ndash;<li   {if $type=='cancel'} class="active" {/if}><a href="{php echo $this->createWebUrl('ddgl',array('type'=>cancel,'status'=>2));}">已取消</a></li>&ndash;&gt;-->
  <!--&lt;!&ndash;<li   {if $type=='complete'} class="active" {/if}><a href="{php echo $this->createWebUrl('ddgl',array('type'=>complete,'status'=>4));}">已完成</a></li>&ndash;&gt;-->
    <!--&lt;!&ndash;<li   {if $type=='refund'} class="active" {/if}><a href="{php echo $this->createWebUrl('ddgl',array('type'=>refund,'status'=>5));}">待退款</a></li>&ndash;&gt;-->
    <!--&lt;!&ndash;<li   {if $type=='completerefund'} class="active" {/if}><a href="{php echo $this->createWebUrl('ddgl',array('type'=>completerefund,'status'=>6));}">已退款</a></li>&ndash;&gt;-->
    <!--&lt;!&ndash;<li   {if $type=='reject'} class="active" {/if}><a href="{php echo $this->createWebUrl('ddgl',array('type'=>reject,'status'=>7));}">退款拒绝</a></li>&ndash;&gt;-->
</ul>

  

<div class="main">
   <!--  <div class="panel panel-default">
        <div class="panel-body">
            <a class="btn btn-primary" href="javascript:location.reload()"><i class="fa fa-refresh"></i>刷新</a>
        </div>
    </div> -->
        <!-- <div class="panel panel-default">
            <div class="panel-body"> -->
               
               <!--  <form action="" method="get" class="col-md-4">
                    <input type="hidden" name="c" value="site" />
                    <input type="hidden" name="a" value="entry" />
                    <input type="hidden" name="m" value="zh_jypx" />
                    <input type="hidden" name="do" value="task" />
                    <div class="input-group" style="width: 300px">
                        <input type="text" name="keywords" class="form-control" placeholder="请输入作业标题">
                        <span class="input-group-btn">
                    <input type="submit" class="btn btn-default" name="submit" value="查找"/>
                </span>
                    </div>
                    <input type="hidden" name="token" value="{$_W['token']}"/>
                    <input type="hidden" name="type" value="all"/>
                </form> -->
                <!-- <form class="col-lg-2" action="" method="POST">
                    <div style="width: 100px">

                        <input type="submit" class="btn btn-sm btn-success" name="export_submit" value="导出"/>
                        <input type="hidden" name="token" value="{$_W['token']}"/>

                    </div>
                </form>
 -->

                <!-- 批量部分 -->
        <!--     </div>
        </div> -->

    <div class="panel panel-default">
        <div class="panel-heading">
           <div class="btn btn-md ygyouhui2" id="allselect">批量删除</div>
      </div>
        <div class="panel-body" style="padding: 0px 15px;">
            <div class="row">
                <table class="yg5_tabel col-md-12">

                    <tr class="yg5_tr1">
                        <th class="store_td1 col-md-1">
                            <input type="checkbox" class="allcheck" />
                            <span class="store_inp">全选</span>
                        </th>

                        <th class="col-md-1">课程名称</th>
                        <th class="col-md-1">课节名称</th>
                        <!-- <th class="col-md-1">课节数字名称</th> -->
                        <th class="col-md-1">图片</th>
                        <th class="col-md-2">作业名称</th>
                        <th class="col-md-1">结束时间</th>
                        <th class="col-md-2">操作</th>

                    </tr>
                    {loop $list $item}
              <tr class="yg5_tr2">
                 <td>
                    <input type="checkbox" name="test" value="{$item['id']}">
                 </td>

                  <td>
                      {$item['name']}
                  </td>
                  <td >
                      {$item['unit_name']}
                  </td>
                  <!-- <td>
                      {$item['num']}
                  </td> -->
                <td><div class="type-parent"><img height="40" src="{media $item['thumb']}">&nbsp;&nbsp;</div></td>

                 <td >
               {$item['title']}
                </td>
                 <td >
               {$item['create_time']}
                </td>
                  <!-- {if $item['state']==1}
                  <td >
                      <span class="label label-warning">待批改</span>
                  </td>
                  {elseif $item['state']==2}
                  <td >
                      <span class="label label-info"> 已批改</span>
                  </td>
                  {/if}
 -->
                  <td>
                      <a href="{php echo $this->createWebUrl('addtask', array('id' => $item['id'],unit_id=>$item['unit_id']))}" class="storespan btn btn-xs">
                                <span class="fa fa-pencil"></span>
                                <span class="bianji">编辑<span class="arrowdown"></span>
                                </span>
                            
                            </a>
                      <a href="javascript:void(0);" class="storespan btn btn-xs" data-toggle="modal" data-target="#myModal{$item['id']}">
                          <span class="fa fa-trash-o"></span>
                          <span class="bianji">删除<span class="arrowdown"></span>
                                </span>
                      </a>
                  </td>

              </tr>
                    <div class="modal fade" id="myModal{$item['id']}" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
                        <div class="modal-dialog" role="document">
                            <div class="modal-content">
                                <div class="modal-header">
                                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                                    <h4 class="modal-title" id="myModalLabel" style="font-size: 20px;">提示</h4>
                                </div>
                                <div class="modal-body" style="font-size: 20px">
                                    确定删除么？
                                </div>
                                <div class="modal-footer">
                                    <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                                    <a href="{php echo $this->createWebUrl('task', array('op' => 'delete', 'id' => $item['id']))}" type="button" class="btn btn-info" >确定</a>
                                </div>
                            </div>
                        </div>
                    </div>
                   
                  {/loop}

                {if empty($list)}
               <tr class="yg5_tr2">
                  <td colspan="10">
                    暂无信息
                  </td>
                </tr>

              {/if}

                </table>
            </div>
        </form>
    </div>
    {$pager}
</div>
</div>
<script type="text/javascript">
    $(function(){
        // $("#frame-12").addClass("in");
        $("#frame-5").show();
        $("#yframe-5").addClass("wyactive");

        $("#allselect").on('click',function(){
            var check = $("input[type=checkbox][class!=allcheck]:checked");
            if(check.length < 1){
                alert('请选择要删除的作业!');
                return false;
            }else if(confirm("确认要删除此作业?")){
                var id = new Array();
                check.each(function(i){
                    id[i] = $(this).val();
                });
                console.log(id)
                $.ajax({
                    type:"post",
                    url:"{$_W['siteroot']}/app/index.php?i={$_W['uniacid']}&c=entry&do=DeleteTask&m=zh_jypx",
                    dataType:"text",
                    data:{id:id},
                    success:function(data){
                        console.log(data);
                        location.reload();
                    }
                })

            }
        });
        $(".allcheck").on('click',function(){
            var checked = $(this).get(0).checked;
            $("input[type=checkbox]").prop("checked",checked);
        });

    })
</script>